<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>

</body>

<script>
function t(){
	var date = "2020.09.10";
	var reg = /^[1-9]\d{3}\.(0[1-9]|1[0-2])\.(0[1-9]|[1-2][0-9]|3[0-1])$/;
	var regExp = new RegExp(reg);
	if(!regExp.test(date)){
		alert("日期格式不正确！正确格式为：2015.01.01");
		return false;
	}
	else return true;
}
alert(t());
</script>
</html>